package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.jpa.data.core.BaseResource;
import com.nbsaas.boot.project.api.apis.ProjectTimeApi;
import com.nbsaas.boot.project.api.domain.request.ProjectTimeRequest;
import com.nbsaas.boot.project.api.domain.response.ProjectTimeResponse;
import com.nbsaas.boot.project.api.domain.simple.ProjectTimeSimple;
import com.nbsaas.boot.project.data.entity.ProjectTime;
import com.nbsaas.boot.project.data.repository.ProjectTimeRepository;
import com.nbsaas.boot.project.rest.convert.ProjectTimeEntityConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTimeResponseConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTimeSimpleConvert;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.function.Function;
/**
 *   项目计时-业务接口实现
 */
@Transactional
@Service
public class ProjectTimeResource extends BaseResource<ProjectTime, ProjectTimeResponse, ProjectTimeSimple, ProjectTimeRequest> implements ProjectTimeApi {

    @Resource
    private ProjectTimeRepository projectTimeRepository;

    @Override
    public JpaRepositoryImplementation<ProjectTime, Serializable> getJpaRepository() {
        return projectTimeRepository;
    }

    @Override
    public Function<ProjectTime, ProjectTimeSimple> getConvertSimple() {
        return new ProjectTimeSimpleConvert();
    }

    @Override
    public Function<ProjectTimeRequest, ProjectTime> getConvertForm() {
        return new ProjectTimeEntityConvert();
    }

    @Override
    public Function<ProjectTime, ProjectTimeResponse> getConvertResponse() {
        return new ProjectTimeResponseConvert();
    }


}


